import './assets/main.css'

import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import App from './App.vue'
import 'element-plus/dist/index.css'
import "./router/guard.js"
import { createPinia } from 'pinia';
import * as dingtalk from 'dingtalk-jsapi'; // 引入钉钉 JSAPI

const app = createApp(App)

// 创建 Pinia 实例并挂载到 Vue 应用
app.use(createPinia());
app.use(ElementPlus);

// 初始化钉钉 JSAPI
dingtalk.ready(() => {
    console.log("钉钉环境已加载");

    // 打印钉钉平台环境信息（如是否是钉钉内置浏览器等）
    console.log(dingtalk.env.platform); // 例如：dingtalk 或 notInDingTalk
});

// 如果初始化失败，打印错误信息
dingtalk.error((error) => {
    console.error("钉钉 JSAPI 初始化失败", error);
});

app.mount('#app');
